<template>
  <div>
    <el-form ref="form" :model="form" label-width="80px">
      <el-form-item label="客户ID">
        <el-input v-model="form.custID"  :disabled='true'></el-input>
      </el-form-item>
      <el-form-item label="姓名">
        <el-input v-model="form.cname"></el-input>
      </el-form-item>
      <el-form-item label="联系方式">
        <el-input v-model="form.phone"></el-input>
      </el-form-item> 
      <el-form-item label="地址">
        <el-input v-model="form.address"></el-input>
      </el-form-item>
     

     
     
      <el-form-item>
        <el-button type="primary" @click="onSubmit">确认</el-button>
        <el-button @click="reset">取消</el-button>
      </el-form-item>
    </el-form>
  </div>
</template>

<script>
import axios from 'axios';
import qs from 'qs'
export default {
  data() {
    return {
      form: {
        cname: "",
        custID: "",
        phone: "",
        address: ""
      
      },
      money: 3000,
    };
  },
  methods: {
    onSubmit() {
      axios({
        url:'http://localhost:3000/editCust',
        method:'post',
        data:qs.stringify(this.form)
      })
      history.back()
    },
    reset(){
      this.$router.push('/customer')
    }
  },
  mounted(){
    axios({
      url:'http://localhost:3000/customerInfo',
      method:'get',
      params:{
        id:this.$route.query.i
      }
    }).then((success)=>{
      this.form=success.data
    })
  }
};
</script>

<style scoped>
</style>